package com.btb.adapter.constant;

import java.util.Arrays;
import java.util.Objects;

// 链上事件处理
public enum EventType {
	HERO_CHAIN_UP("1"),  //英雄上链
	FISH_CHAIN_UP("2"),  //鱼上链
	OFF_CHAIN("3");  //下链
	private String type;

	private EventType(String type) {
		this.type = type;
	}

	public String getType() {
		return type;
	}

	public static boolean checkType(Integer type) {
		return Arrays.stream(values()).anyMatch(x -> Objects.equals(Integer.parseInt(x.getType()), type));
	}

	public static boolean check(String type) {
		return Arrays.stream(values()).anyMatch(x -> Objects.equals(x.name().toLowerCase(), type));
	}

	public static EventType type(String type) {
		return Arrays.stream(values()).filter(x -> Objects.equals(x.name().toLowerCase(), type)).findAny().orElse(null);
	}
}
